package com.jimline.phonebook.ui;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class DialPanel extends JPanel
{
	private static final String m_btnText[][] = {
		{"1", "2", "3"},
		{"4", "5", "6"},
		{"7", "8", "9"},
		{"*/+", "0", "#"},
		{"Add", "Dial", "BackSpace"}
	};
	
	private JTextField m_numberInput;
	
	public DialPanel()
	{
		m_numberInput = new JTextField();
		JPanel numPnl = new JPanel();
		BorderLayout mainLyt = new BorderLayout();
		
		this.setLayout(mainLyt);
		
		GridLayout numLyt = new GridLayout(5, 3);
		numPnl.setLayout(numLyt);
		
		for (int i = 0; i < 5; ++i) {
			for (int j = 0; j < 3; ++j) {
				JButton btn = new JButton(m_btnText[i][j]);
				btn.addMouseListener(new MyMouseAdapter());
				numPnl.add(btn);
			}
		}
		
		this.add(m_numberInput, BorderLayout.NORTH);
		this.add(numPnl, BorderLayout.CENTER);
	}
	
	private class MyMouseAdapter extends MouseAdapter
	{
		public void mouseClicked(MouseEvent e) {
			
		}

		public void mousePressed(MouseEvent e) {
			
		}

		public void mouseReleased(MouseEvent e) {
			
		}
	}
}